package cz.zcu.fav.rat.managed.bean;

import java.io.Serializable;

import javax.faces.context.FacesContext;

public abstract class AbstractEditBean implements Serializable
{
	private static final long serialVersionUID = 7628532051146772443L;
	protected Integer id;

	public void init()
	{
		id = getId();
	}
	
	protected Integer getId()
	{
		try
		{
			String idAsString = FacesContext.getCurrentInstance()
					.getExternalContext().getRequestParameterMap().get("id");
			return Integer.valueOf(idAsString);
		} catch (NumberFormatException ex)
		{
			return null;
		}
	}
	
	public abstract void create();
	public abstract String edit();

	
}
